package main;

import org.softmed.rest.admin.RESTConfigurationManager;
import org.softmed.rest.admin.file.FileManager;
import org.softmed.rest.admin.file.FileManagerProxy;

import restlet.description.convert.RESTConfigurationDescription;
import restlet.description.convert.RESTModuleDescription;


public class ConfigurationManagerProxy implements ConfigurationManager {

	RESTConfigurationManager configurationManager = new RESTConfigurationManager();

	public ConfigurationManagerProxy(FileManager fileManager) {
		configurationManager.setFileManager(fileManager);
	}

	@Override
	public RESTConfigurationDescription loadConfiguration(String path)
			throws Throwable {
		return configurationManager.loadConfigurationFile(path);
	}

	@Override
	public void saveConfiguration(RESTConfigurationDescription configuration,
			String path) throws Throwable {
		configurationManager.saveConfigurationFile(configuration, path);

	}

	@Override
	public RESTModuleDescription loadModule(String path) throws Throwable {
		return configurationManager.loadModule(path);
	}

	@Override
	public void saveModule(RESTModuleDescription module) throws Throwable {
		configurationManager.saveModule(module);

	}

	@Override
	public String getHandler(String path) throws Throwable {
		return configurationManager.loadHandler(path);
	}

	@Override
	public void saveHandler(String path, String code) throws Throwable {
		configurationManager.saveHandler(path, code);

	}

	public RESTConfigurationManager getConfigurationManager() {
		return configurationManager;
	}

}
